import { fileURLToPath, URL } from 'url'
import autoImport from 'unplugin-auto-import/vite'
import components from 'unplugin-vue-components/vite'
import { VarletUIResolver } from 'unplugin-vue-components/resolvers'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    components({
      resolvers: [VarletUIResolver()]
    }),
    autoImport({
    resolvers: [VarletUIResolver({ autoImport: true })],
    imports: [
      'vue',
      'vue-router',
    ],
    defaultExportByFilename: true,
    dirs: [
      './src/api/',
      './src/utils/',
    ],
  })],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  css:{
    preprocessorOptions: {
      less: {
          charset: false,
          additionalData: `@import "@/assets/less/theme.less";`
      }
   }
  },
  server:{
    hmr:{
      overlay:false
    },
    port:8080
  }
})
